cd  /opt/software
tar zxf  azkaban-db-0.1.0-SNAPSHOT.tar
tar zxf  azkaban-web-server-0.1.0-SNAPSHOT.tar
tar zxf  azkaban-exec-server-0.1.0-SNAPSHOT.tar
mv  azkaban-db-0.1.0-SNAPSHOT  azkaban-db
mv  azkaban-web-server-0.1.0-SNAPSHOT  azkaban-web
mv  azkaban-exec-server-0.1.0-SNAPSHOT  azkaban-exec

#初始化数据库
systemctl start  mysqld
mysql -uroot -p123456 -e "create database azkaban"
mysql -uroot -p123456 -e "use azkaban"
mysql -uroot -p123456 -e "source  azkaban-db/create-all-sql-0.1.0-SNAPSHOT.sql"

#编辑azkaban-exec配置文件
sed -i 's/^.*default\.timezone\.id.*$/default.timezone.id=Asia\/Shanghai/'  azkaban-exec/conf/azkaban.properties
sed -i 's/^.*mysql\.user.*$/mysql.user=root/'  azkaban-exec/conf/azkaban.properties
sed -i 's/^.*mysql\.password.*$/mysql.password=123456/'  azkaban-exec/conf/azkaban.properties
sed -i '$a executor.port=12321' azkaban-exec/conf/azkaban.properties
#关闭azkaban内存检查
sed -i '$a memCheck.enabled=false'  /opt/software/azkaban-exec/plugins/jobtypes/commonprivate.properties

#编辑azkaban-web配置文件
sed -i 's/^.*default\.timezone\.id.*$/default.timezone.id=Asia\/Shanghai/'  azkaban-web/conf/azkaban.properties
sed -i 's/^.*mysql\.user.*$/mysql.user=root/'  azkaban-web/conf/azkaban.properties
sed -i 's/^.*mysql\.password.*$/mysql.password=123456/'  azkaban-web/conf/azkaban.properties

# 编辑internal-start-web.sh 文件，设置正确的hadoop相关jar包路径
sed -i '30c\CLASSPATH=$CLASSPATH:$HADOOP_HOME/share/hadoop/common/*:$HADOOP_HOME/share/hadoop/common/lib/*:$HADOOP_HOME/share/hadoop/mapreduce/*:$HADOOP_HOME/share/hadoop/mapreduce/lib/*'  azkaban-web/bin/internal/internal-start-web.sh 

#启动exec server
cd azkaban-exec
bin/start-exec.sh
#激活exec server
curl -G "localhost:12321/executor?action=activate" && echo
#启动web server
cd ../azkaban-web
bin/start-web.sh